
var comonReflux = require("./common-reflux.js");

var miniServer = {
    clone:function(obj){
       return $.extend(true,{} , obj);
    },
    addUnFn:function(){

    },
     componentWillMount: function () {
        var unFn = [];
        this.server  = (function(){
            var server,action,store;            
            return {
                init:function(callBackEvent){
                      server = comonReflux.init();
                      action = server.CommonActions;
                      store = server.CommonStore;
                      this.destory = store.listen(callBackEvent);
                      unFn.push(this.destory);
                      return action;
                },
                destory:function(){

                }

            }
        })()
        this.unFn = unFn;

    },
    componentWillUnmount:function(){
      this.canselServer();
    },
    canselServer:function(){
       var i = 0,j = this.unFn.length;
        for(;i<j;i++){
            this.unFn[i]();
            console.log("页面关系取消  "+i)
        }
    }
}


module.exports = miniServer;
